package cn.qingxuntech.console.service

import cn.qingxuntech.console.entity.LogRecord
import cn.qingxuntech.console.mapper.LogRecordMapper
import com.mybatisflex.core.query.QueryWrapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

@Service
class LogRecordService {

    @Autowired
    lateinit var logRecordMapper: LogRecordMapper

    fun last10Records(logRecord: LogRecord): List<LogRecord> {

        return logRecordMapper.selectListByQuery(QueryWrapper.create()
            .eq(LogRecord::adspaceId, logRecord.adspaceId)
            .orderBy(LogRecord::insertTime, false)
            .limit(10)
        )
    }
}